package com.jingdianjichi.oss.service;

import com.jingdianjichi.oss.entity.FileInfo;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.List;

/**
 * ClassName:StorageService
 * Package:com.jingdianjichi.oss.service
 * Description:
 *
 * @Author fst
 * @Create 2024/10/3 21:20
 * @Version 1.0
 */

@Service
public interface StorageAdapter {

    void createBucket(String bucket);

    /**
     * 上传文件
     *
     */


    void uploadFile(MultipartFile multipartFile, String bucket, String objectName);

    /**
     * 列出所有桶
     */
    List<String> getAllBucket();

    /**
     * 查询桶中的文件
     */
    List<FileInfo> getAllFile(String bucket);

    /**
     * 下载文件
     */

    InputStream downLoad(String bucket, String objectName);

    /**
     * 删除文件
     *
     */
    void deleteObject(String bucket, String objectName);

    /**
     * 删除桶
     */
    void deleteBucket(String bucket);

    String getUrl(String bucketName, String objectName);
}
